using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;

namespace WebService.Entities
{
    public partial class OAContext : DbContext
    {
        public OAContext()
            : base("name=OAContext")
        {
        }

        public virtual DbSet<Job> Job { get; set; }
        public virtual DbSet<OilMaterialOrder> OilMaterialOrder { get; set; }
        public virtual DbSet<OilMaterialOrderDetail> OilMaterialOrderDetail { get; set; }
        public virtual DbSet<OrganizationStructure> OrganizationStructure { get; set; }
        public virtual DbSet<ProcessItem> ProcessItem { get; set; }
        public virtual DbSet<ProcessStepRecord> ProcessStepRecord { get; set; }
        public virtual DbSet<ProcessTemplate> ProcessTemplate { get; set; }
        public virtual DbSet<Resignation> Resignation { get; set; }
        public virtual DbSet<Role> Role { get; set; }
        public virtual DbSet<RoleResourceModule> RoleResourceModule { get; set; }
        public virtual DbSet<Staff> Staff { get; set; }
        public virtual DbSet<StaffRole> StaffRole { get; set; }
        public virtual DbSet<SystemResourceModule> SystemResourceModule { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<ProcessStepRecord>()
                .Property(e => e.Id)
                .IsUnicode(false);

            modelBuilder.Entity<ProcessStepRecord>()
                .Property(e => e.Type)
                .IsUnicode(false);

            modelBuilder.Entity<ProcessStepRecord>()
                .Property(e => e.WaitForExecutionStaffId)
                .IsUnicode(false);

            modelBuilder.Entity<ProcessStepRecord>()
                .Property(e => e.RefOrderId)
                .IsUnicode(false);

            modelBuilder.Entity<ProcessTemplate>()
                .Property(e => e.Id)
                .IsUnicode(false);

            modelBuilder.Entity<ProcessTemplate>()
                .Property(e => e.Type)
                .IsUnicode(false);

            modelBuilder.Entity<ProcessTemplate>()
                .Property(e => e.WaitForExecutionStaffId)
                .IsUnicode(false);

            modelBuilder.Entity<Resignation>()
                .Property(e => e.Id)
                .IsUnicode(false);

            modelBuilder.Entity<Resignation>()
                .Property(e => e.No)
                .IsUnicode(false);

            modelBuilder.Entity<Resignation>()
                .Property(e => e.LeaveType)
                .IsFixedLength()
                .IsUnicode(false);

            modelBuilder.Entity<Staff>()
                .Property(e => e.Status)
                .IsFixedLength()
                .IsUnicode(false);
        }
    }
}
